package servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/regist")
public class RegistServlet extends HttpServlet{

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// 1.获取参数
		String username = req.getParameter("username");
		String userpwd = req.getParameter("userpwd");
		String sex = req.getParameter("sex");
		String birthday = req.getParameter("birthday");
		String[] skill = req.getParameterValues("skill");
		String className = req.getParameter("className");
		String motto = req.getParameter("motto");
		
		// 封装成对象，添加到数据库
		
		// 2.设置resp
		resp.setContentType("text/html;charset=utf-8");
		resp.setCharacterEncoding("utf-8");
		PrintWriter out = resp.getWriter();
		
		if (true) {
			// 转发
			req.setCharacterEncoding("utf-8");
			req.getRequestDispatcher("/index.html").forward(req, resp);
		}
	}
}
